import { ApiDataContext } from "../domain/apiDataContext";
import { BaseService } from "./baseService";
import { Page } from "../domain/models/page";
import { Transaction } from "tiny-entity2";

export class PageService extends BaseService {
    CreatePage(entity: Page, ctx?: ApiDataContext) {
        ctx || (ctx = new ApiDataContext());
        return Transaction(ctx, async (ctx) => {
            let d = new Page();
            d.ConverToEntity(entity);
            return ctx.Create(d);
        });
    }
    UpdatePage(entity: Page, ctx?: ApiDataContext) {
        ctx || (ctx = new ApiDataContext());
        return Transaction(ctx, async (ctx) => {
            let d = new Page();
            d.ConverToEntity(entity);
            return ctx.Create(d);
        });
    }
    GetPageById(id: string) {
        let ctx = new ApiDataContext();
    }
    QueryPage(params) {
        let ctx = new ApiDataContext();
    }
}